package com.sakiko.audiobook;

import com.sakiko.audiobook.common.constant.RedisConstant;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * projectName: com.sakiko.audiobook
 *
 * @author: sakiko
 * time: 2025/8/22 20:45
 * description:
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceAlbumApplication implements CommandLineRunner {

    @Autowired
    private RedissonClient redissonClient;

    public static void main(String[] args) {
        SpringApplication.run(ServiceAlbumApplication.class);
    }

    @Override
    public void run(String... args) throws Exception {
        // 第一步: 初始化布隆过滤器
        redissonClient.getBloomFilter(RedisConstant.ALBUM_BLOOM_FILTER)
                .tryInit(100000L,0.001);
    }
}
